package cn.jinhaze.controller.admin;

import cn.jinhaze.common.pojo.dto.OrderDTO;
import cn.jinhaze.common.pojo.dto.OrderHandleDTO;
import cn.jinhaze.common.pojo.dto.OrderPageDTO;
import cn.jinhaze.common.pojo.vo.OrderVO;
import cn.jinhaze.common.result.Result;
import cn.jinhaze.service.OrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: L29
 * @create: 2024-12-25 14:19
 * @Version 1.0
 */
@RestController
@RequestMapping("/admin/order")
@Tag(name = "管理员订单管理", description = "管理员订单相关接口")
public class AdminOrderController {

	@Autowired
	private OrderService orderService;

	@PostMapping
	@Operation(summary = "获取订单列表")
	public Result<List<OrderVO>> list(@RequestBody OrderPageDTO orderPageDTO) {
		List<OrderVO> orderVOList = orderService.list(orderPageDTO);
		return Result.success(orderVOList);
	}

	@PostMapping("/handle")
	@Operation(summary = "处理订单")
	public Result handleOrder(@RequestBody OrderHandleDTO orderHandleDTO) {
		orderService.handleOrder(orderHandleDTO);
		return Result.success();
	}
}